load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "extension",
    srcs = [
        "auth.go",
        "extensions.go",
        "function.go",
        "manifest.go",
        "registry.go",
        "session.go",
        "util.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/extension",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/parser",
        "//pkg/parser/ast",
        "//pkg/parser/auth",
        "//pkg/parser/mysql",
        "//pkg/privilege/conn",
        "//pkg/sessionctx/stmtctx",
        "//pkg/sessionctx/variable",
        "//pkg/types",
        "//pkg/util/chunk",
        "@com_github_ngaut_pools//:pools",
        "@com_github_pingcap_errors//:errors",
        "@io_etcd_go_etcd_client_v3//:client",
    ],
)

go_test(
    name = "extension_test",
    timeout = "short",
    srcs = [
        "auth_test.go",
        "bootstrap_test.go",
        "event_listener_test.go",
        "function_test.go",
        "main_test.go",
        "registry_test.go",
    ],
    embed = [":extension"],
    flaky = True,
    shard_count = 21,
    deps = [
        "//pkg/expression",
        "//pkg/parser/ast",
        "//pkg/parser/auth",
        "//pkg/parser/mysql",
        "//pkg/planner/util/fixcontrol",
        "//pkg/privilege/privileges",
        "//pkg/server",
        "//pkg/sessionctx",
        "//pkg/sessionctx/sessionstates",
        "//pkg/sessionctx/stmtctx",
        "//pkg/sessionctx/vardef",
        "//pkg/sessionctx/variable",
        "//pkg/testkit",
        "//pkg/testkit/testsetup",
        "//pkg/types",
        "//pkg/util/chunk",
        "//pkg/util/mock",
        "//pkg/util/sem/compat",
        "@com_github_pingcap_errors//:errors",
        "@com_github_stretchr_testify//mock",
        "@com_github_stretchr_testify//require",
        "@org_uber_go_goleak//:goleak",
    ],
)
